home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_352 / mg / src.lzh / h / buffer.h next >
C/C++ Source or Header  |  1990-05-23  |  2KB  |  74 lines

  1. #ifndef BUFFER_H
  2. #define BUFFER_H
  3.  
  4. /*
  5.  * Text is kept in buffers. A buffer header, described below, exists for
  6.  * every buffer in the system. The buffers are kept in a big list, so that
  7.  * commands that search for a buffer by name can find the buffer header.
  8.  * There is a safe store for the dot and mark in the header, but this is only
  9.  * valid if the buffer is not being displayed (that is, if "b_nwnd" is 0).
  10.  * The text for the buffer is kept in a circularly linked list of lines, with
  11.  * a pointer to the header line in "b_linep".
  12.  */
  13.  
  14. #ifndef    LIST_H
  15. #include "list.h"
  16. #endif
  17.  
  18. #ifndef KBD_H
  19. #include "kbd.h"
  20. #endif
  21.  
  22. #include "foob.h"
  23.  
  24. struct buffer {
  25.     struct list     b_list;    /* buffer list pointer     */
  26.     struct buffer  *b_altb;    /* Link to alternate buffer */
  27.     struct line    *b_dotp;    /* Link to "." LINE structure */
  28.     struct line    *b_markp;/* ditto for mark     */
  29.     struct line    *b_linep;/* Link to the header LINE */
  30.     struct maps    *b_modes[PBMODES];    /* buffer modes         */
  31. #ifdef    FOOB
  32.     FOOB            b_foob;    /* File Out Of Band Data */
  33. #endif
  34.     short           b_doto;    /* Offset of "." in above LINE */
  35.     short           b_marko;/* ditto for the "mark"         */
  36.     short           b_nmodes;    /* number of non-fundamental modes */
  37.     char            b_nwnd;    /* Count of windows on buffer     */
  38.     char            b_flag;    /* Flags             */
  39.     char            b_fname[NFILEN];    /* File name             */
  40. };
  41. #define b_bufp    b_list.l_p.x_bp
  42. #define b_bname b_list.l_name
  43.  
  44. #define BFCHG    0x01        /* Changed.             */
  45. #define BFBAK    0x02        /* Need to make a backup.     */
  46. #define BFNOTAB 0x04        /* no tab mode             */
  47. #define BFOVERWRITE 0x08    /* overwrite mode         */
  48.  
  49. /*
  50.  * Buffer externals.
  51.  */
  52. extern struct buffer *curbp;
  53. extern struct buffer *bheadp;
  54. extern struct buffer *bfind();
  55. /*
  56.  * Prototypes for buffer functions.
  57.  */
  58. #ifndef    NO_PROTO
  59. struct buffer  *makelist(VOID);
  60. int             addline(struct buffer * bp, char *text);
  61. struct buffer  *bfind(char *bname, int cflag);
  62. int             bclear(struct buffer * bp);
  63. int             popbuftop(struct buffer * bp);
  64. int             writeout(struct buffer * bp, char *fn);
  65. struct buffer  *findbuffer(char *fname);
  66. int             buffsave(struct buffer * bp);
  67. VOID            upmodes(struct buffer * bp);
  68.  
  69. /* Define things that need the buffer structure */
  70. int        ffputbuf(struct buffer * bp);
  71. struct buffer  *dired_ PROTO((char *));
  72. #endif
  73. #endif
  74.